This code reproduces the fMRI analyses reported in the following manuscript:

Mindful attention to alcohol can reduce cravings in the moment and consumption in daily life

load packages

library(pacman)
pacman::p_load(tidyverse, brms, ggeffects, tidybayes, ROCR, caret, interactions, modelr, broom.mixed, performance, install = TRUE)
devtools::install_github("hadley/emo")

define aesthetics

palette = c("#e64626", "#1985a1", "#4c5c68", "#FAC748")
palette_group = c(palette[2], palette[4])

plot_aes = theme_minimal() +
  theme(legend.position = "top",
        legend.text = element_text(size = 16),
        plot.title = element_text(hjust = 0.5),
        text = element_text(size = 18, family = "Futura Medium"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        axis.text = element_text(color = "black"),
        axis.line = element_line(colour = "black"),
        axis.ticks.y = element_blank())

define functions

make_table = function(data) {
    data %>%
      broom.mixed::tidy(conf.int = TRUE, conf.level = 0.9) %>%
      filter(effect == "fixed") %>%
      mutate(term = gsub("\\(Intercept\\)", "intercept", term),
             term = gsub("trial_condregulation", "task condition (mindful attention)", term),
             term = gsub("trial_cond_recode", "task condition (mindful attention)", term),
             term = gsub("trial_condmindfulattention", "task condition (mindful attention)", term),
             term = gsub("dot_between_std_noc", "signature expression (between)", term),
             term = gsub("dot_within_std", "signature expression (within)", term),
             term = gsub("dot_sd", "signature expression variability", term),
             term = gsub("regulation_expression", "signature expression", term),
             term = gsub("confidence_rating", "confidence rating", term),
             term = gsub("MAAS_mean", "MAAS score", term),
             term = gsub(":", " x  ", term),
             `b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", estimate, conf.low, conf.high),) %>%
      select(term, `b [90% CI]`) %>%
      knitr::kable(digits = 2)
}

load data

classifier_data = read.csv("../data/classifier_data.csv", stringsAsFactors = FALSE) %>%
  mutate(predicted_factor = as.factor(predicted_factor),
         actual_factor = as.factor(actual_factor))
ratings = read.csv("../data/ratings.csv", stringsAsFactors = FALSE)
maas = read.csv("../data/MAAS.csv", stringsAsFactors = FALSE)
merged = read.csv("../data/task_neuro_data.csv", stringsAsFactors = FALSE)
disaggregated = read.csv("../data/disaggregated_data.csv", stringsAsFactors = FALSE)
disaggregated_mindful = disaggregated %>%
  filter(condition == "mindful attention")

mindful attention signature development analyses

Here is the weight map from the MVPA analyses:

cross-validation accuracy

✅ We expect that we will be able to train a classifier at the run level to distinguish mindful attention from uninstructed reactivity to alcohol cues with greater than chance accuracy decoding.

caret::confusionMatrix(classifier_data$predicted_factor, classifier_data$actual_factor)
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction react regulate
##   react       59       45
##   regulate    52       66
##                                           
##                Accuracy : 0.5631          
##                  95% CI : (0.4951, 0.6293)
##     No Information Rate : 0.5             
##     P-Value [Acc > NIR] : 0.03486         
##                                           
##                   Kappa : 0.1261          
##                                           
##  Mcnemar's Test P-Value : 0.54239         
##                                           
##             Sensitivity : 0.5315          
##             Specificity : 0.5946          
##          Pos Pred Value : 0.5673          
##          Neg Pred Value : 0.5593          
##              Prevalence : 0.5000          
##          Detection Rate : 0.2658          
##    Detection Prevalence : 0.4685          
##       Balanced Accuracy : 0.5631          
##                                           
##        'Positive' Class : react           
## 

trial-level accuracy

✅ Given that the classifier is developed at the run level, we will also confirm that the expression of the mindful attention signature is evident at the trial-level. That is, we expect the signature expression to be higher during mindful attention trials compared to reactivity trials.

means

plot

data_means = merged %>%
  filter(condition == "mindful attention") %>%
  mutate(trial_cond = gsub("regulation", "mindful attention", trial_cond),
         trial_cond = factor(trial_cond, levels = c("reactivity", "mindful attention")),
         dot_std = scale(dot, center = TRUE, scale = TRUE))

data_means %>%
  ggplot(aes(trial_cond, dot, color = trial_cond, fill = trial_cond)) +
  stat_summary(fun.data = "mean_cl_boot", geom = "bar") +
  stat_summary(fun.data = "mean_cl_boot", geom = "errorbar", width = 0, color = "black") +
  scale_color_manual(name = "", values = palette) +
  scale_fill_manual(name = "", values = palette) +
  labs(x = "\ntrial type", y = "signature expression\n") +
  plot_aes +
  theme(legend.position = "none")

run model

prior = c(prior(normal(0, 1), class=b))

mod_means = brms::brm(dot_std ~ trial_cond + (1 + trial_cond | pID),
                      data = data_means, 
                      prior = prior,
                      cores = 8, iter = 1000, silent = TRUE, seed = 6523)

table

make_table(mod_means)
term b [90% CI]
intercept -0.41 [-0.45, -0.36]
task condition (mindful attention) 0.85 [0.79, 0.91]

summary

summary(mod_means, prob = .9)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: dot_std ~ trial_cond + (1 + trial_cond | pID) 
##    Data: data_means (Number of observations: 2245) 
##   Draws: 4 chains, each with iter = 1000; warmup = 500; thin = 1;
##          total post-warmup draws = 2000
## 
## Group-Level Effects: 
## ~pID (Number of levels: 37) 
##                                           Estimate Est.Error l-90% CI u-90% CI
## sd(Intercept)                                 0.03      0.02     0.00     0.07
## sd(trial_condmindfulattention)                0.04      0.03     0.00     0.09
## cor(Intercept,trial_condmindfulattention)    -0.17      0.58    -0.95     0.87
##                                           Rhat Bulk_ESS Tail_ESS
## sd(Intercept)                             1.00     1047      874
## sd(trial_condmindfulattention)            1.00     1067     1057
## cor(Intercept,trial_condmindfulattention) 1.00     1873     1446
## 
## Population-Level Effects: 
##                            Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS
## Intercept                     -0.41      0.03    -0.45    -0.36 1.01     3630
## trial_condmindfulattention     0.85      0.04     0.79     0.91 1.01     3509
##                            Tail_ESS
## Intercept                      1413
## trial_condmindfulattention     1288
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sigma     0.91      0.01     0.88     0.93 1.00     3844      993
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

ROC plot

acc_line1 = data.frame(x = c(0, 1), y = c(1, 1))
acc_line2 = data.frame(y = c(0, 1), x = c(0, 0))

merged %>%
  filter(condition %in% c("mindful attention")) %>%
  filter(!is.na(dot)) %>%
  mutate(actual = ifelse(trial_cond == "regulation", 1, 0)) %>%
  group_by(condition) %>%
  do({
    condition = .$condition
    pred = prediction(.$dot, .$actual)
    perf = ROCR::performance(pred, measure = "tpr", x.measure = "fpr")
    data.frame(cut = perf@alpha.values[[1]],fpr = perf@x.values[[1]],tpr = perf@y.values[[1]])
  }) %>%
  ggplot(aes(fpr, tpr)) +
    geom_line(aes(color = condition), size = 1) +
    geom_abline(intercept = 0, slope = 1) +
    geom_line(data = acc_line1, aes(x, y)) +
    geom_line(data = acc_line2, aes(x, y)) +
    scale_color_manual(values = palette_group) +
    scale_x_continuous(breaks = seq(0, 1, .2)) +
    scale_y_continuous(breaks = seq(0, 1, .2)) +
    labs(x = "\nfalse positive rate (1 - specificity)", y = "true positive rate (sensitivity)\n") +
    plot_aes +
    theme(legend.position = "none",
          legend.spacing.y = unit(-.1, "cm"))

confusion matrix

conf_data = merged %>%
  filter(condition == "mindful attention") %>%
  filter(!is.na(dot)) %>%
  mutate(predicted = ifelse(dot > 0, "regulation",
                     ifelse(dot < 0, "reactivity", NA)),
         predicted = as.factor(predicted),
         trial_cond = as.factor(as.character(trial_cond)))

caret::confusionMatrix(conf_data$predicted, conf_data$trial_cond)
## Confusion Matrix and Statistics
## 
##             Reference
## Prediction   reactivity regulation
##   reactivity        827        333
##   regulation        346        739
##                                              
##                Accuracy : 0.6976             
##                  95% CI : (0.6781, 0.7165)   
##     No Information Rate : 0.5225             
##     P-Value [Acc > NIR] : <0.0000000000000002
##                                              
##                   Kappa : 0.3942             
##                                              
##  Mcnemar's Test P-Value : 0.6451             
##                                              
##             Sensitivity : 0.7050             
##             Specificity : 0.6894             
##          Pos Pred Value : 0.7129             
##          Neg Pred Value : 0.6811             
##              Prevalence : 0.5225             
##          Detection Rate : 0.3684             
##    Detection Prevalence : 0.5167             
##       Balanced Accuracy : 0.6972             
##                                              
##        'Positive' Class : reactivity         
## 

descriptive statistics

craving

disaggregated_mindful %>%
  group_by(trial_cond) %>%
  summarize(M = mean(resp, na.rm = TRUE),
          SD = sd(resp, na.rm = TRUE)) %>%
  knitr::kable(digits = 1, format = "pandoc")
trial_cond M SD
reactivity 2.0 1.1
regulation 1.9 1.0

efficacy: trial-level craving analyses

H1

✅ Compared to reactivity trials, mindful attention trials will be associated with decreased craving

run model

mod_behavior = brms::brm(resp ~ 1 + trial_cond +
                (1 + trial_cond | pID) + (1 | stimulus),
                disaggregated_mindful, 
                prior = prior,
                cores = 8, iter = 1000, silent = TRUE, seed = 6523)

plot

mod_behavior %>%
  spread_draws(b_Intercept, b_trial_condregulation) %>%
  mutate(reactivity = b_Intercept,
         mindfulness = b_Intercept + b_trial_condregulation) %>%
  gather(`trial type`, value, reactivity, mindfulness) %>%
  ggplot(aes(y = "", x = value, fill = `trial type`)) +
  stat_halfeye(alpha = .5) +
  scale_fill_manual(values = c(palette[2], palette[1])) +
  scale_y_discrete(expand = c(.1, .1)) +
  coord_cartesian(xlim = c(1.5, 2.5)) +
  labs(x = "\npredicted craving rating\n", y = "") + 
  plot_aes

table

make_table(mod_behavior)
term b [90% CI]
intercept 2.01 [1.82, 2.20]
task condition (mindful attention) -0.12 [-0.21, -0.03]

summary

summary(mod_behavior, prob = .9)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: resp ~ 1 + trial_cond + (1 + trial_cond | pID) + (1 | stimulus) 
##    Data: disaggregated_mindful (Number of observations: 2214) 
##   Draws: 4 chains, each with iter = 1000; warmup = 500; thin = 1;
##          total post-warmup draws = 2000
## 
## Group-Level Effects: 
## ~pID (Number of levels: 37) 
##                                     Estimate Est.Error l-90% CI u-90% CI Rhat
## sd(Intercept)                           0.60      0.08     0.49     0.74 1.01
## sd(trial_condregulation)                0.21      0.07     0.09     0.32 1.02
## cor(Intercept,trial_condregulation)    -0.10      0.26    -0.49     0.32 1.01
##                                     Bulk_ESS Tail_ESS
## sd(Intercept)                            489      728
## sd(trial_condregulation)                 328      191
## cor(Intercept,trial_condregulation)     1356      867
## 
## ~stimulus (Number of levels: 72) 
##               Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.39      0.04     0.33     0.46 1.01      422      705
## 
## Population-Level Effects: 
##                      Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS
## Intercept                2.01      0.12     1.82     2.20 1.02      279
## trial_condregulation    -0.12      0.05    -0.21    -0.03 1.00     1391
##                      Tail_ESS
## Intercept                 670
## trial_condregulation     1452
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sigma     0.85      0.01     0.83     0.87 1.00     2916     1343
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

ICC

participant

performance::variance_decomposition(mod_behavior, re_formula = ~ (1 + trial_cond | pID))
## # Random Effect Variances and ICC
## 
## Conditioned on: ~(1 + trial_cond | pID)
## 
## ## Variance Ratio (comparable to ICC)
## Ratio: 0.32  CI 95%: [0.25 0.37]
## 
## ## Variances of Posterior Predicted Distribution
## Conditioned on fixed effects: 0.72  CI 95%: [0.67 0.79]
## Conditioned on rand. effects: 1.06  CI 95%: [0.98 1.14]
## 
## ## Difference in Variances
## Difference: 0.33  CI 95%: [0.25 0.42]

stimulus

performance::variance_decomposition(mod_behavior, re_formula = ~ (1 | stimulus))
## # Random Effect Variances and ICC
## 
## Conditioned on: ~(1 | stimulus)
## 
## ## Variance Ratio (comparable to ICC)
## Ratio: 0.17  CI 95%: [0.09 0.24]
## 
## ## Variances of Posterior Predicted Distribution
## Conditioned on fixed effects: 0.72  CI 95%: [0.67 0.79]
## Conditioned on rand. effects: 0.87  CI 95%: [0.81 0.95]
## 
## ## Difference in Variances
## Difference: 0.15  CI 95%: [0.08 0.22]

H2

✅ A: We expect that people who have greater expression of the mindful attention signature on average (i.e., L2, between-person expression) will also have lower craving ratings on a trial-by-trial basis.

❌ B: We expect that trials with greater expression of the mindful attention signature compared to one’s average (i.e., L1, within-person expression) will be associated with lower craving ratings on a trial-by-trial basis.

run model

mod_h2_int = brms::brm(resp ~ 1 + trial_cond * dot_between_std_noc +
                         trial_cond * dot_within_std +
                         (1 + trial_cond * dot_within_std | pID) + (1 | stimulus),
                disaggregated_mindful, 
                prior = prior,
                cores = 8, iter = 1000, silent = TRUE, seed = 6523)

plots

between-person

points_between = disaggregated_mindful %>%
  select(pID, resp, trial_cond, dot_between_std_noc) %>%
  group_by(pID, trial_cond, dot_between_std_noc) %>%
  summarize(resp = mean(resp, na.rm = TRUE)) %>%
  mutate(group = ifelse(trial_cond == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")),
         type = "between-person") %>%
  rename("x" = dot_between_std_noc,
         "predicted" = resp)

vals = modelr::seq_range(points_between$x, n = 25)

predicted = ggeffects::ggpredict(mod_h2_int, c("dot_between_std_noc [vals]", "trial_cond"), 
                                 ci.lvl = 0.9) %>%
  data.frame() %>%
  mutate(type = "between-person") %>%
  mutate(group = ifelse(group == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")))

(between = predicted %>%
  ggplot(aes(x, predicted, color = group, fill = group)) +
  geom_point(data = points_between, alpha = .4, size = 2) +
  geom_line(data = points_between, aes(group = pID), alpha = .4, size = 1.25, color = "grey") +
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .2, color = NA) +
  geom_line(size = 2) +
  scale_fill_manual(name = "trial type", values = palette) +
  scale_color_manual(name = "trial type", values = palette) +
  scale_y_continuous(breaks = c(1,2,3)) +
  labs(x = expression("\nreactivity " * symbol('\254') * " signature expression " * symbol('\256') * " mindful attention"),
       y = "craving rating\n",
       title = "between-person") +
  plot_aes +
  theme(legend.position = "top"))

within-person

points_within = disaggregated_mindful %>%
  select(pID, resp, trial_cond, dot_within_std) %>%
  mutate(group = ifelse(trial_cond == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")),
         type = "within-person") %>%
  rename("x" = dot_within_std,
         "predicted" = resp)

vals = modelr::seq_range(points_within$x, n = 25)

predicted = ggeffects::ggpredict(mod_h2_int, c("dot_within_std [vals]", "trial_cond"),
                                 ci.lvl = 0.9) %>%
  data.frame() %>%
  mutate(group = ifelse(group == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")))

(within = predicted %>%
  ggplot(aes(x, predicted, color = group, fill = group)) +
  stat_smooth(data = points_within, aes(group = interaction(pID, group)), geom = "line", method = "lm", alpha = 0.15, se = FALSE, size = 1.25, fullrange = TRUE) + 
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .3, color = NA) + 
  geom_line(size = 2) +
  scale_fill_manual(name = "trial type", values = palette) +
  scale_color_manual(name = "trial type", values = palette) +
  labs(x = "within-person signature expression (SD)",
       y = "craving rating\n",
       title = "within-person") +
  plot_aes +
  theme(legend.position = "top"))

combined

ggpubr::ggarrange(between, within, nrow = 1, common.legend = TRUE)

table

make_table(mod_h2_int)
term b [90% CI]
intercept 2.27 [1.97, 2.57]
task condition (mindful attention) -0.20 [-0.57, 0.17]
signature expression (between) 0.25 [0.03, 0.48]
signature expression (within) -0.01 [-0.06, 0.03]
task condition (mindful attention) x signature expression (between) -0.45 [-0.84, -0.06]
task condition (mindful attention) x signature expression (within) -0.01 [-0.08, 0.06]

simple slopes

emmeans::emtrends(mod_h2_int, ~ trial_cond, var="dot_between_std_noc", level = 0.9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", dot_between_std_noc.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity 0.25 [0.05, 0.49]
mindful attention -0.20 [-0.51, 0.12]
emmeans::emtrends(mod_h2_int, ~ trial_cond, var="dot_within_std", level = 0.9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", dot_within_std.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity -0.01 [-0.06, 0.03]
mindful attention -0.03 [-0.08, 0.03]

summary

summary(mod_h2_int, prob = .9)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: resp ~ 1 + trial_cond * dot_between_std_noc + trial_cond * dot_within_std + (1 + trial_cond * dot_within_std | pID) + (1 | stimulus) 
##    Data: disaggregated_mindful (Number of observations: 2193) 
##   Draws: 4 chains, each with iter = 1000; warmup = 500; thin = 1;
##          total post-warmup draws = 2000
## 
## Group-Level Effects: 
## ~pID (Number of levels: 37) 
##                                                               Estimate
## sd(Intercept)                                                     0.59
## sd(trial_condregulation)                                          0.17
## sd(dot_within_std)                                                0.04
## sd(trial_condregulation:dot_within_std)                           0.10
## cor(Intercept,trial_condregulation)                               0.01
## cor(Intercept,dot_within_std)                                     0.22
## cor(trial_condregulation,dot_within_std)                          0.06
## cor(Intercept,trial_condregulation:dot_within_std)               -0.37
## cor(trial_condregulation,trial_condregulation:dot_within_std)     0.19
## cor(dot_within_std,trial_condregulation:dot_within_std)          -0.17
##                                                               Est.Error
## sd(Intercept)                                                      0.08
## sd(trial_condregulation)                                           0.07
## sd(dot_within_std)                                                 0.03
## sd(trial_condregulation:dot_within_std)                            0.05
## cor(Intercept,trial_condregulation)                                0.27
## cor(Intercept,dot_within_std)                                      0.41
## cor(trial_condregulation,dot_within_std)                           0.43
## cor(Intercept,trial_condregulation:dot_within_std)                 0.31
## cor(trial_condregulation,trial_condregulation:dot_within_std)      0.39
## cor(dot_within_std,trial_condregulation:dot_within_std)            0.44
##                                                               l-90% CI u-90% CI
## sd(Intercept)                                                     0.48     0.73
## sd(trial_condregulation)                                          0.03     0.29
## sd(dot_within_std)                                                0.00     0.10
## sd(trial_condregulation:dot_within_std)                           0.02     0.18
## cor(Intercept,trial_condregulation)                              -0.41     0.47
## cor(Intercept,dot_within_std)                                    -0.53     0.80
## cor(trial_condregulation,dot_within_std)                         -0.67     0.76
## cor(Intercept,trial_condregulation:dot_within_std)               -0.82     0.18
## cor(trial_condregulation,trial_condregulation:dot_within_std)    -0.49     0.77
## cor(dot_within_std,trial_condregulation:dot_within_std)          -0.82     0.62
##                                                               Rhat Bulk_ESS
## sd(Intercept)                                                 1.01      571
## sd(trial_condregulation)                                      1.03      183
## sd(dot_within_std)                                            1.00      783
## sd(trial_condregulation:dot_within_std)                       1.01      611
## cor(Intercept,trial_condregulation)                           1.00     1620
## cor(Intercept,dot_within_std)                                 1.00     2041
## cor(trial_condregulation,dot_within_std)                      1.01     1891
## cor(Intercept,trial_condregulation:dot_within_std)            1.00     1839
## cor(trial_condregulation,trial_condregulation:dot_within_std) 1.01     1077
## cor(dot_within_std,trial_condregulation:dot_within_std)       1.00     1257
##                                                               Tail_ESS
## sd(Intercept)                                                      717
## sd(trial_condregulation)                                            69
## sd(dot_within_std)                                                 750
## sd(trial_condregulation:dot_within_std)                            585
## cor(Intercept,trial_condregulation)                                902
## cor(Intercept,dot_within_std)                                     1341
## cor(trial_condregulation,dot_within_std)                          1454
## cor(Intercept,trial_condregulation:dot_within_std)                1165
## cor(trial_condregulation,trial_condregulation:dot_within_std)     1298
## cor(dot_within_std,trial_condregulation:dot_within_std)           1463
## 
## ~stimulus (Number of levels: 72) 
##               Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.39      0.04     0.33     0.45 1.00      716     1109
## 
## Population-Level Effects: 
##                                          Estimate Est.Error l-90% CI u-90% CI
## Intercept                                    2.27      0.18     1.97     2.57
## trial_condregulation                        -0.20      0.23    -0.57     0.17
## dot_between_std_noc                          0.25      0.14     0.03     0.48
## dot_within_std                              -0.01      0.03    -0.06     0.03
## trial_condregulation:dot_between_std_noc    -0.45      0.24    -0.84    -0.06
## trial_condregulation:dot_within_std         -0.01      0.04    -0.08     0.06
##                                          Rhat Bulk_ESS Tail_ESS
## Intercept                                1.01      658      848
## trial_condregulation                     1.00     1522     1528
## dot_between_std_noc                      1.00     1080     1289
## dot_within_std                           1.00     2387     1594
## trial_condregulation:dot_between_std_noc 1.00     1373     1268
## trial_condregulation:dot_within_std      1.00     2117     1672
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sigma     0.85      0.01     0.83     0.87 1.00     2904     1425
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

ICC

participant

performance::variance_decomposition(mod_h2_int, re_formula = ~ (1 + trial_cond * dot_within_std | pID))
## # Random Effect Variances and ICC
## 
## Conditioned on: ~(1 + trial_cond * dot_within_std | pID)
## 
## ## Variance Ratio (comparable to ICC)
## Ratio: 0.31  CI 95%: [0.25 0.37]
## 
## ## Variances of Posterior Predicted Distribution
## Conditioned on fixed effects: 0.73  CI 95%: [0.67 0.80]
## Conditioned on rand. effects: 1.06  CI 95%: [0.98 1.14]
## 
## ## Difference in Variances
## Difference: 0.33  CI 95%: [0.25 0.41]

stimulus

performance::variance_decomposition(mod_h2_int, re_formula = ~ (1 | stimulus))
## # Random Effect Variances and ICC
## 
## Conditioned on: ~(1 | stimulus)
## 
## ## Variance Ratio (comparable to ICC)
## Ratio: 0.17  CI 95%: [0.09 0.24]
## 
## ## Variances of Posterior Predicted Distribution
## Conditioned on fixed effects: 0.73  CI 95%: [0.67 0.79]
## Conditioned on rand. effects: 0.88  CI 95%: [0.81 0.95]
## 
## ## Difference in Variances
## Difference: 0.15  CI 95%: [0.08 0.22]

sensitivity analyses

mindful signature attention: discriminant validity

To examine discriminant validity, we will apply the mindful attention signature to data from a separate group of participants who were instructed to use a different form of cognitive regulation (i.e., not mindful attention) that is not expected to rely on the same brain regions. We expect lower than chance accuracy decoding alcohol regulation versus reactivity trials.

ROC plot

acc_line1 = data.frame(x = c(0, 1), y = c(1, 1))
acc_line2 = data.frame(y = c(0, 1), x = c(0, 0))

merged %>%
  filter(condition %in% c("perspective-taking", "mindful attention")) %>%
  filter(!is.na(dot)) %>%
  mutate(actual = ifelse(trial_cond == "regulation", 1, 0)) %>%
  group_by(condition) %>%
  do({
    condition = .$condition
    pred = prediction(.$dot, .$actual)
    perf = ROCR::performance(pred, measure = "tpr", x.measure = "fpr")
    data.frame(cut = perf@alpha.values[[1]],fpr = perf@x.values[[1]],tpr = perf@y.values[[1]])
  }) %>%
  ggplot(aes(fpr, tpr)) +
    geom_line(aes(color = condition), size = 1) +
    geom_abline(intercept = 0, slope = 1) +
    geom_line(data = acc_line1, aes(x, y)) +
    geom_line(data = acc_line2, aes(x, y)) +
    scale_x_continuous(breaks = seq(0, 1, .2)) +
    scale_y_continuous(breaks = seq(0, 1, .2)) +
    scale_color_manual(name = "", values = palette_group) +
    labs(x = "\nfalse positive rate (1 - specificity)", y = "true positive rate (sensitivity)\n") +
    plot_aes +
    theme(legend.position = c(.75, .15),
        legend.spacing.y = unit(-.1, "cm"))

confusion matrix

conf_data = merged %>%
  filter(condition == "perspective-taking") %>%
  filter(!is.na(dot)) %>%
  mutate(predicted = ifelse(dot > 0, "regulation",
                     ifelse(dot < 0, "reactivity", NA)),
         predicted = as.factor(predicted),
         trial_cond = as.factor(as.character(trial_cond)))

caret::confusionMatrix(conf_data$predicted, conf_data$trial_cond)
## Confusion Matrix and Statistics
## 
##             Reference
## Prediction   reactivity regulation
##   reactivity        469        419
##   regulation        341        391
##                                           
##                Accuracy : 0.5309          
##                  95% CI : (0.5062, 0.5554)
##     No Information Rate : 0.5             
##     P-Value [Acc > NIR] : 0.006941        
##                                           
##                   Kappa : 0.0617          
##                                           
##  Mcnemar's Test P-Value : 0.005221        
##                                           
##             Sensitivity : 0.5790          
##             Specificity : 0.4827          
##          Pos Pred Value : 0.5282          
##          Neg Pred Value : 0.5342          
##              Prevalence : 0.5000          
##          Detection Rate : 0.2895          
##    Detection Prevalence : 0.5481          
##       Balanced Accuracy : 0.5309          
##                                           
##        'Positive' Class : reactivity      
## 

confidence rating analyses

merged_ratings = disaggregated_mindful %>%
  left_join(., ratings) %>%
  left_join(., maas)

correlation between confidence and signature expression

corr_data = disaggregated_mindful %>%
  filter(trial_cond == "regulation") %>%
  select(pID, dot_between) %>%
  unique() %>%
  left_join(., ratings)

cor.test(corr_data$confidence_rating, corr_data$dot_between)
## 
##  Pearson's product-moment correlation
## 
## data:  corr_data$confidence_rating and corr_data$dot_between
## t = 0.16437, df = 31, p-value = 0.8705
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3170124  0.3690782
## sample estimates:
##        cor 
## 0.02950807

signature expression ~ confidence ratings

We examined the degree to which confidence ratings were associated with neural signature expression

run model

mod_ph_expression = brms::brm(dot ~ confidence_rating * trial_cond + (1 + trial_cond | pID),
                           data = merged_ratings,
                           prior = prior,
                           cores = 8, iter = 1000, silent = TRUE, seed = 6523)

plot

ggeffects::ggpredict(mod_ph_expression, terms = c("confidence_rating", "trial_cond"),
                     ci.lvl = 0.9) %>%
  data.frame() %>%
  mutate(group = ifelse(group == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention"))) %>%
  ggplot(aes(x, predicted, color = group, fill = group)) +
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .2, color = NA) +
  geom_line(size = 2) +
  scale_fill_manual(name = "trial type", values = palette) +
  scale_color_manual(name = "trial type", values = palette) +
  labs(x = "instruction confidence rating (SD)",
       y = "signature expression\n") +
  plot_aes +
  theme(legend.position = "top")

table

make_table(mod_ph_expression)
term b [90% CI]
intercept -1.80 [-3.95, 0.37]
confidence rating 0.04 [-0.79, 0.85]
task condition (mindful attention) 3.08 [1.23, 5.02]
confidence rating x task condition (mindful attention) 0.01 [-1.30, 1.27]

simple slopes

emmeans::emtrends(mod_ph_expression, ~ trial_cond, var="confidence_rating", level = .9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", confidence_rating.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity 0.04 [-0.81, 0.81]
mindful attention 0.06 [-0.86, 0.93]

summary

summary(mod_ph_expression, prob = .9)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: dot ~ confidence_rating * trial_cond + (1 + trial_cond | pID) 
##    Data: merged_ratings (Number of observations: 2086) 
##   Draws: 4 chains, each with iter = 1000; warmup = 500; thin = 1;
##          total post-warmup draws = 2000
## 
## Group-Level Effects: 
## ~pID (Number of levels: 33) 
##                                     Estimate Est.Error l-90% CI u-90% CI Rhat
## sd(Intercept)                           5.53      1.60     3.10     8.32 1.00
## sd(trial_condregulation)               10.19      1.82     7.51    13.31 1.00
## cor(Intercept,trial_condregulation)    -0.99      0.02    -1.00    -0.95 1.01
##                                     Bulk_ESS Tail_ESS
## sd(Intercept)                            500      722
## sd(trial_condregulation)                 644     1045
## cor(Intercept,trial_condregulation)      483      559
## 
## Population-Level Effects: 
##                                        Estimate Est.Error l-90% CI u-90% CI
## Intercept                                 -1.80      1.32    -3.95     0.37
## confidence_rating                          0.04      0.50    -0.79     0.85
## trial_condregulation                       3.08      1.14     1.23     5.02
## confidence_rating:trial_condregulation     0.01      0.79    -1.30     1.27
##                                        Rhat Bulk_ESS Tail_ESS
## Intercept                              1.01      561      884
## confidence_rating                      1.00     1360     1509
## trial_condregulation                   1.00     1234     1210
## confidence_rating:trial_condregulation 1.00     1270     1218
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sigma    14.29      0.22    13.93    14.64 1.00     5279     1564
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

H2 controlling for confidence ratings

We examined the degree to which controlling for confidence ratings affected the results for H2

run model

mod_ph_h2 = brms::brm(resp ~ 1 + trial_cond * dot_between_std_noc +
                        trial_cond * dot_within_std +
                        trial_cond * confidence_rating +
                        (1 + trial_cond * dot_within_std | pID) + (1 | stimulus),
                      data = merged_ratings,
                      prior = prior,
                      cores = 8, iter = 1000, silent = TRUE, seed = 6523)

plots

between-person
points_between = disaggregated_mindful %>%
  select(pID, resp, trial_cond, dot_between_std_noc) %>%
  group_by(pID, trial_cond, dot_between_std_noc) %>%
  summarize(resp = mean(resp, na.rm = TRUE)) %>%
  mutate(group = ifelse(trial_cond == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")),
         type = "between-person") %>%
  rename("x" = dot_between_std_noc,
         "predicted" = resp)

vals = modelr::seq_range(points_between$x, n = 25)

predicted = ggeffects::ggpredict(mod_ph_h2, c("dot_between_std_noc [vals]", "trial_cond"),
                                 ci.lvl = 0.9) %>%
  data.frame() %>%
  mutate(type = "between-person") %>%
  mutate(group = ifelse(group == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")))

predicted %>%
  ggplot(aes(x, predicted, color = group, fill = group)) +
  geom_point(data = points_between, alpha = .4, size = 2) +
  geom_line(data = points_between, aes(group = pID), alpha = .4, size = 1.5, color = "grey") +
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .2, color = NA) +
  geom_line(size = 2) +
  scale_fill_manual(name = "trial type", values = palette) +
  scale_color_manual(name = "trial type", values = palette) +
  labs(x = expression("\nreactivity " * symbol('\254') * " signature expression " * symbol('\256') * " mindful attention"),
       y = "craving rating\n") +
  plot_aes +
  theme(legend.position = "top")

within-person only
points_within = disaggregated_mindful %>%
  select(pID, resp, trial_cond, dot_within_std) %>%
  mutate(group = ifelse(trial_cond == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")),
         type = "within-person") %>%
  rename("x" = dot_within_std,
         "predicted" = resp)

vals = modelr::seq_range(points_within$x, n = 25)

predicted = ggeffects::ggpredict(mod_ph_h2, c("dot_within_std [vals]", "trial_cond"),
                                 ci.lvl = 0.9) %>%
  data.frame() %>%
  mutate(group = ifelse(group == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")))

predicted %>%
  ggplot(aes(x, predicted, color = group, fill = group)) +
  stat_smooth(data = points_within, aes(group = interaction(pID, group)), geom = "line", method = "lm", alpha = 0.15, se = FALSE, size = 1.25, fullrange = TRUE) + 
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .3, color = NA) + 
  geom_line(size = 2) +
  scale_fill_manual(name = "trial type", values = palette) +
  scale_color_manual(name = "trial type", values = palette) +
  labs(x = "within-person signature expression (SD)",
       y = "craving rating\n",
       title = "within-person") +
  plot_aes +
  theme(legend.position = "top")

table

make_table(mod_ph_h2)
term b [90% CI]
intercept 2.30 [2.00, 2.60]
task condition (mindful attention) -0.21 [-0.60, 0.18]
signature expression (between) 0.25 [0.03, 0.47]
signature expression (within) -0.01 [-0.06, 0.04]
confidence rating -0.02 [-0.21, 0.16]
task condition (mindful attention) x signature expression (between) -0.44 [-0.79, -0.07]
task condition (mindful attention) x signature expression (within) -0.02 [-0.10, 0.06]
task condition (mindful attention) x confidence rating -0.12 [-0.20, -0.03]

simple slopes

signature expression
emmeans::emtrends(mod_ph_h2, ~ trial_cond, var="dot_between_std_noc", level = .9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", dot_between_std_noc.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity 0.25 [0.02, 0.46]
mindful attention -0.19 [-0.49, 0.13]
emmeans::emtrends(mod_ph_h2, ~ trial_cond, var="dot_within_std", level = .9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", dot_within_std.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity -0.01 [-0.06, 0.04]
mindful attention -0.03 [-0.10, 0.03]
confidence ratings
emmeans::emtrends(mod_ph_h2, ~ trial_cond, var="confidence_rating", level = .9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", confidence_rating.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity -0.02 [-0.20, 0.16]
mindful attention -0.14 [-0.32, 0.05]

summary

summary(mod_ph_h2, prob = .9)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: resp ~ 1 + trial_cond * dot_between_std_noc + trial_cond * dot_within_std + trial_cond * confidence_rating + (1 + trial_cond * dot_within_std | pID) + (1 | stimulus) 
##    Data: merged_ratings (Number of observations: 2034) 
##   Draws: 4 chains, each with iter = 1000; warmup = 500; thin = 1;
##          total post-warmup draws = 2000
## 
## Group-Level Effects: 
## ~pID (Number of levels: 33) 
##                                                               Estimate
## sd(Intercept)                                                     0.63
## sd(trial_condregulation)                                          0.15
## sd(dot_within_std)                                                0.05
## sd(trial_condregulation:dot_within_std)                           0.11
## cor(Intercept,trial_condregulation)                              -0.11
## cor(Intercept,dot_within_std)                                     0.18
## cor(trial_condregulation,dot_within_std)                         -0.00
## cor(Intercept,trial_condregulation:dot_within_std)               -0.35
## cor(trial_condregulation,trial_condregulation:dot_within_std)     0.30
## cor(dot_within_std,trial_condregulation:dot_within_std)          -0.15
##                                                               Est.Error
## sd(Intercept)                                                      0.09
## sd(trial_condregulation)                                           0.07
## sd(dot_within_std)                                                 0.03
## sd(trial_condregulation:dot_within_std)                            0.05
## cor(Intercept,trial_condregulation)                                0.30
## cor(Intercept,dot_within_std)                                      0.39
## cor(trial_condregulation,dot_within_std)                           0.44
## cor(Intercept,trial_condregulation:dot_within_std)                 0.31
## cor(trial_condregulation,trial_condregulation:dot_within_std)      0.38
## cor(dot_within_std,trial_condregulation:dot_within_std)            0.44
##                                                               l-90% CI u-90% CI
## sd(Intercept)                                                     0.50     0.80
## sd(trial_condregulation)                                          0.04     0.26
## sd(dot_within_std)                                                0.00     0.11
## sd(trial_condregulation:dot_within_std)                           0.02     0.19
## cor(Intercept,trial_condregulation)                              -0.56     0.41
## cor(Intercept,dot_within_std)                                    -0.52     0.78
## cor(trial_condregulation,dot_within_std)                         -0.71     0.71
## cor(Intercept,trial_condregulation:dot_within_std)               -0.80     0.21
## cor(trial_condregulation,trial_condregulation:dot_within_std)    -0.41     0.83
## cor(dot_within_std,trial_condregulation:dot_within_std)          -0.79     0.64
##                                                               Rhat Bulk_ESS
## sd(Intercept)                                                 1.00      704
## sd(trial_condregulation)                                      1.00      498
## sd(dot_within_std)                                            1.00      853
## sd(trial_condregulation:dot_within_std)                       1.00      574
## cor(Intercept,trial_condregulation)                           1.00     2920
## cor(Intercept,dot_within_std)                                 1.00     2211
## cor(trial_condregulation,dot_within_std)                      1.00     2127
## cor(Intercept,trial_condregulation:dot_within_std)            1.00     1986
## cor(trial_condregulation,trial_condregulation:dot_within_std) 1.00     1071
## cor(dot_within_std,trial_condregulation:dot_within_std)       1.00     1172
##                                                               Tail_ESS
## sd(Intercept)                                                     1024
## sd(trial_condregulation)                                           851
## sd(dot_within_std)                                                1160
## sd(trial_condregulation:dot_within_std)                            466
## cor(Intercept,trial_condregulation)                               1374
## cor(Intercept,dot_within_std)                                     1403
## cor(trial_condregulation,dot_within_std)                          1661
## cor(Intercept,trial_condregulation:dot_within_std)                1146
## cor(trial_condregulation,trial_condregulation:dot_within_std)     1446
## cor(dot_within_std,trial_condregulation:dot_within_std)           1385
## 
## ~stimulus (Number of levels: 72) 
##               Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.40      0.04     0.34     0.47 1.00      675     1169
## 
## Population-Level Effects: 
##                                          Estimate Est.Error l-90% CI u-90% CI
## Intercept                                    2.30      0.18     2.00     2.60
## trial_condregulation                        -0.21      0.24    -0.60     0.18
## dot_between_std_noc                          0.25      0.14     0.03     0.47
## dot_within_std                              -0.01      0.03    -0.06     0.04
## confidence_rating                           -0.02      0.11    -0.21     0.16
## trial_condregulation:dot_between_std_noc    -0.44      0.22    -0.79    -0.07
## trial_condregulation:dot_within_std         -0.02      0.05    -0.10     0.06
## trial_condregulation:confidence_rating      -0.12      0.05    -0.20    -0.03
##                                          Rhat Bulk_ESS Tail_ESS
## Intercept                                1.00      811     1149
## trial_condregulation                     1.00     1601      953
## dot_between_std_noc                      1.00     1489     1326
## dot_within_std                           1.00     3573     1542
## confidence_rating                        1.00      611      950
## trial_condregulation:dot_between_std_noc 1.00     1938     1713
## trial_condregulation:dot_within_std      1.00     2390     1478
## trial_condregulation:confidence_rating   1.00     2102     1572
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sigma     0.85      0.01     0.82     0.87 1.00     2692      985
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

compare posterior distributions

Compare preregistered model with the modeling controlling for confidence ratings

posterior = posterior_samples(mod_h2_int) %>%
  transmute(`mindful attention`= b_dot_between_std_noc + `b_trial_condregulation:dot_between_std_noc`,
            reactivity = b_dot_between_std_noc) %>%
  gather(`trial type`, value) %>%
  mutate(model = "original model") %>%
  bind_rows(posterior_samples(mod_ph_h2) %>%
              transmute(`mindful attention`= b_dot_between_std_noc + `b_trial_condregulation:dot_between_std_noc`,
                        reactivity = b_dot_between_std_noc) %>%
              gather(`trial type`, value) %>%
              mutate(model = "controlling for confidence")) %>% 
  mutate(model = factor(model, levels = c("original model", "controlling for confidence")))

posterior %>%
  ggplot(aes(y = "", x = value, fill = model)) +
  stat_halfeye(alpha = .5) +
  scale_fill_manual(values = palette_group) +
  facet_grid(~`trial type`) +
  scale_y_discrete(expand = c(.1, .1)) +
  labs(x = "\nregression coefficient\n", y = "") + 
  plot_aes

Mindful Attention and Awareness (MAAS) analyses

merged_ratings = disaggregated_mindful %>%
  left_join(., maas)

correlation between MAAS and signature expression

corr_data = disaggregated_mindful %>%
  filter(trial_cond == "regulation") %>%
  select(pID, dot_between) %>%
  unique() %>%
  left_join(., maas)

cor.test(corr_data$MAAS_mean, corr_data$dot_between)
## 
##  Pearson's product-moment correlation
## 
## data:  corr_data$MAAS_mean and corr_data$dot_between
## t = 0.47248, df = 32, p-value = 0.6398
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2623152  0.4098632
## sample estimates:
##        cor 
## 0.08323381

signature expression ~ MAAS scores

We examined the degree to which MAAS scores were associated with neural signature expression

run model

mod_ph_expression = brms::brm(dot ~ MAAS_mean * trial_cond + (1 + trial_cond | pID),
                           data = merged_ratings,
                           prior = prior,
                           cores = 8, iter = 1000, silent = TRUE, seed = 6523)

plot

ggeffects::ggpredict(mod_ph_expression, terms = c("MAAS_mean", "trial_cond"),
                     ci.lvl = 0.9) %>%
  data.frame() %>%
  mutate(group = ifelse(group == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention"))) %>%
  ggplot(aes(x, predicted, color = group, fill = group)) +
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .2, color = NA) +
  geom_line(size = 2) +
  scale_fill_manual(name = "trial type", values = palette) +
  scale_color_manual(name = "trial type", values = palette) +
  labs(x = "MAAS score (SD)",
       y = "signature expression\n") +
  plot_aes +
  theme(legend.position = "top")

table

make_table(mod_ph_expression)
term b [90% CI]
intercept -3.12 [-5.52, -0.90]
MAAS score 0.44 [-0.40, 1.23]
task condition (mindful attention) 3.70 [1.70, 5.68]
MAAS score x task condition (mindful attention) -0.34 [-1.77, 1.13]

simple slopes

emmeans::emtrends(mod_ph_expression, ~ trial_cond, var="MAAS_mean", level = .9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", MAAS_mean.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity 0.46 [-0.40, 1.22]
mindful attention 0.13 [-0.96, 1.24]

summary

summary(mod_ph_expression, prob = .9)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: dot ~ MAAS_mean * trial_cond + (1 + trial_cond | pID) 
##    Data: merged_ratings (Number of observations: 2245) 
##   Draws: 4 chains, each with iter = 1000; warmup = 500; thin = 1;
##          total post-warmup draws = 2000
## 
## Group-Level Effects: 
## ~pID (Number of levels: 37) 
##                                     Estimate Est.Error l-90% CI u-90% CI Rhat
## sd(Intercept)                           3.92      1.51     1.48     6.43 1.05
## sd(trial_condregulation)                9.21      1.83     6.40    12.25 1.01
## cor(Intercept,trial_condregulation)    -0.95      0.13    -1.00    -0.83 1.05
##                                     Bulk_ESS Tail_ESS
## sd(Intercept)                             65      207
## sd(trial_condregulation)                 408      854
## cor(Intercept,trial_condregulation)      100       57
## 
## Population-Level Effects: 
##                                Estimate Est.Error l-90% CI u-90% CI Rhat
## Intercept                         -3.12      1.38    -5.52    -0.90 1.05
## MAAS_mean                          0.44      0.49    -0.40     1.23 1.01
## trial_condregulation               3.70      1.19     1.70     5.68 1.01
## MAAS_mean:trial_condregulation    -0.34      0.88    -1.77     1.13 1.00
##                                Bulk_ESS Tail_ESS
## Intercept                           100       76
## MAAS_mean                          1003      875
## trial_condregulation                678     1080
## MAAS_mean:trial_condregulation     1020     1076
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sigma    14.18      0.21    13.84    14.52 1.01     3240     1559
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

H2 controlling for MAAS scores

We examined the degree to which controlling for MAAS scores affected the results for H2

run model

mod_ph_h2 = brms::brm(resp ~ 1 + trial_cond * dot_between_std_noc +
                        trial_cond * dot_within_std + 
                        trial_cond * MAAS_mean +
                        (1 + trial_cond * dot_within_std | pID) + (1 | stimulus),
                      data = merged_ratings,
                      prior = prior,
                      cores = 8, iter = 1000, silent = TRUE, seed = 6523)

plots

between-person
points_between = disaggregated_mindful %>%
  select(pID, resp, trial_cond, dot_between_std_noc) %>%
  group_by(pID, trial_cond, dot_between_std_noc) %>%
  summarize(resp = mean(resp, na.rm = TRUE)) %>%
  mutate(group = ifelse(trial_cond == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")),
         type = "between-person") %>%
  rename("x" = dot_between_std_noc,
         "predicted" = resp)

vals = modelr::seq_range(points_between$x, n = 25)

predicted = ggeffects::ggpredict(mod_ph_h2, c("dot_between_std_noc [vals]", "trial_cond"),
                                 ci.lvl = 0.9) %>%
  data.frame() %>%
  mutate(type = "between-person") %>%
  mutate(group = ifelse(group == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")))

predicted %>%
  ggplot(aes(x, predicted, color = group, fill = group)) +
  geom_point(data = points_between, alpha = .4, size = 2) +
  geom_line(data = points_between, aes(group = pID), alpha = .4, size = 1.5, color = "grey") +
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .2, color = NA) +
  geom_line(size = 2) +
  scale_fill_manual(name = "trial type", values = palette) +
  scale_color_manual(name = "trial type", values = palette) +
  labs(x = expression("\nreactivity " * symbol('\254') * " signature expression " * symbol('\256') * " mindful attention"),
       y = "craving rating\n") +
  plot_aes +
  theme(legend.position = "top")

within-person only
points_within = disaggregated_mindful %>%
  select(pID, resp, trial_cond, dot_within_std) %>%
  mutate(group = ifelse(trial_cond == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")),
         type = "within-person") %>%
  rename("x" = dot_within_std,
         "predicted" = resp)

vals = modelr::seq_range(points_within$x, n = 25)

predicted = ggeffects::ggpredict(mod_ph_h2, c("dot_within_std [vals]", "trial_cond"),
                                 ci.lvl = 0.9) %>%
  data.frame() %>%
  mutate(group = ifelse(group == "regulation", "mindful attention", "reactivity"),
         group = factor(group, levels = c("reactivity", "mindful attention")))

predicted %>%
  ggplot(aes(x, predicted, color = group, fill = group)) +
  stat_smooth(data = points_within, aes(group = interaction(pID, group)), geom = "line", method = "lm", alpha = 0.15, se = FALSE, size = 1.25, fullrange = TRUE) + 
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .3, color = NA) + 
  geom_line(size = 2) +
  scale_fill_manual(name = "trial type", values = palette) +
  scale_color_manual(name = "trial type", values = palette) +
  labs(x = "within-person signature expression (SD)",
       y = "craving rating\n",
       title = "within-person") +
  plot_aes +
  theme(legend.position = "top")

table

make_table(mod_ph_h2)
term b [90% CI]
intercept 2.28 [1.97, 2.61]
task condition (mindful attention) -0.21 [-0.61, 0.18]
signature expression (between) 0.27 [0.03, 0.50]
signature expression (within) -0.02 [-0.07, 0.04]
MAAS score -0.05 [-0.23, 0.12]
task condition (mindful attention) x signature expression (between) -0.46 [-0.85, -0.05]
task condition (mindful attention) x signature expression (within) -0.01 [-0.09, 0.06]
task condition (mindful attention) x MAAS score 0.00 [-0.09, 0.10]

simple slopes

signature expression
emmeans::emtrends(mod_ph_h2, ~ trial_cond, var="dot_between_std_noc", level = .9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", dot_between_std_noc.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity 0.27 [0.02, 0.49]
mindful attention -0.20 [-0.52, 0.12]
emmeans::emtrends(mod_ph_h2, ~ trial_cond, var="dot_within_std", level = .9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", dot_within_std.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity -0.02 [-0.06, 0.04]
mindful attention -0.03 [-0.09, 0.03]
MAAS score
emmeans::emtrends(mod_ph_h2, ~ trial_cond, var="MAAS_mean", level = .9) %>%
    data.frame() %>%
    mutate(`b [90% CI]` = sprintf("%.2f [%.2f, %.2f]", MAAS_mean.trend, lower.HPD, upper.HPD),
           trial_cond = recode(trial_cond, "regulation" = "mindful attention")) %>%
  select(trial_cond, `b [90% CI]`) %>%
      knitr::kable()
trial_cond b [90% CI]
reactivity -0.06 [-0.23, 0.12]
mindful attention -0.05 [-0.24, 0.13]

summary

summary(mod_ph_h2, prob = .9)
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: resp ~ 1 + trial_cond * dot_between_std_noc + trial_cond * dot_within_std + trial_cond * MAAS_mean + (1 + trial_cond * dot_within_std | pID) + (1 | stimulus) 
##    Data: merged_ratings (Number of observations: 2193) 
##   Draws: 4 chains, each with iter = 1000; warmup = 500; thin = 1;
##          total post-warmup draws = 2000
## 
## Group-Level Effects: 
## ~pID (Number of levels: 37) 
##                                                               Estimate
## sd(Intercept)                                                     0.60
## sd(trial_condregulation)                                          0.19
## sd(dot_within_std)                                                0.04
## sd(trial_condregulation:dot_within_std)                           0.10
## cor(Intercept,trial_condregulation)                              -0.00
## cor(Intercept,dot_within_std)                                     0.21
## cor(trial_condregulation,dot_within_std)                          0.05
## cor(Intercept,trial_condregulation:dot_within_std)               -0.39
## cor(trial_condregulation,trial_condregulation:dot_within_std)     0.21
## cor(dot_within_std,trial_condregulation:dot_within_std)          -0.17
##                                                               Est.Error
## sd(Intercept)                                                      0.08
## sd(trial_condregulation)                                           0.07
## sd(dot_within_std)                                                 0.03
## sd(trial_condregulation:dot_within_std)                            0.05
## cor(Intercept,trial_condregulation)                                0.26
## cor(Intercept,dot_within_std)                                      0.40
## cor(trial_condregulation,dot_within_std)                           0.43
## cor(Intercept,trial_condregulation:dot_within_std)                 0.30
## cor(trial_condregulation,trial_condregulation:dot_within_std)      0.39
## cor(dot_within_std,trial_condregulation:dot_within_std)            0.44
##                                                               l-90% CI u-90% CI
## sd(Intercept)                                                     0.48     0.74
## sd(trial_condregulation)                                          0.07     0.31
## sd(dot_within_std)                                                0.00     0.10
## sd(trial_condregulation:dot_within_std)                           0.03     0.18
## cor(Intercept,trial_condregulation)                              -0.41     0.44
## cor(Intercept,dot_within_std)                                    -0.52     0.79
## cor(trial_condregulation,dot_within_std)                         -0.67     0.73
## cor(Intercept,trial_condregulation:dot_within_std)               -0.81     0.16
## cor(trial_condregulation,trial_condregulation:dot_within_std)    -0.49     0.80
## cor(dot_within_std,trial_condregulation:dot_within_std)          -0.80     0.62
##                                                               Rhat Bulk_ESS
## sd(Intercept)                                                 1.00      755
## sd(trial_condregulation)                                      1.01      455
## sd(dot_within_std)                                            1.00      937
## sd(trial_condregulation:dot_within_std)                       1.01      941
## cor(Intercept,trial_condregulation)                           1.00     2428
## cor(Intercept,dot_within_std)                                 1.00     2727
## cor(trial_condregulation,dot_within_std)                      1.00     2477
## cor(Intercept,trial_condregulation:dot_within_std)            1.00     2522
## cor(trial_condregulation,trial_condregulation:dot_within_std) 1.00     1315
## cor(dot_within_std,trial_condregulation:dot_within_std)       1.00     1480
##                                                               Tail_ESS
## sd(Intercept)                                                     1048
## sd(trial_condregulation)                                           321
## sd(dot_within_std)                                                 985
## sd(trial_condregulation:dot_within_std)                            983
## cor(Intercept,trial_condregulation)                               1252
## cor(Intercept,dot_within_std)                                     1379
## cor(trial_condregulation,dot_within_std)                          1667
## cor(Intercept,trial_condregulation:dot_within_std)                1417
## cor(trial_condregulation,trial_condregulation:dot_within_std)     1459
## cor(dot_within_std,trial_condregulation:dot_within_std)           1810
## 
## ~stimulus (Number of levels: 72) 
##               Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)     0.39      0.04     0.33     0.45 1.00      736     1326
## 
## Population-Level Effects: 
##                                          Estimate Est.Error l-90% CI u-90% CI
## Intercept                                    2.28      0.19     1.97     2.61
## trial_condregulation                        -0.21      0.24    -0.61     0.18
## dot_between_std_noc                          0.27      0.14     0.03     0.50
## dot_within_std                              -0.02      0.03    -0.07     0.04
## MAAS_mean                                   -0.05      0.11    -0.23     0.12
## trial_condregulation:dot_between_std_noc    -0.46      0.24    -0.85    -0.05
## trial_condregulation:dot_within_std         -0.01      0.05    -0.09     0.06
## trial_condregulation:MAAS_mean               0.00      0.06    -0.09     0.10
##                                          Rhat Bulk_ESS Tail_ESS
## Intercept                                1.00      752     1012
## trial_condregulation                     1.00     1502     1535
## dot_between_std_noc                      1.00     1336     1197
## dot_within_std                           1.00     3058     1751
## MAAS_mean                                1.01      716     1118
## trial_condregulation:dot_between_std_noc 1.00     1945     1345
## trial_condregulation:dot_within_std      1.00     2728     1457
## trial_condregulation:MAAS_mean           1.00     2226     1332
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-90% CI u-90% CI Rhat Bulk_ESS Tail_ESS
## sigma     0.85      0.01     0.82     0.87 1.00     3058     1415
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

compare posterior distributions

Compare preregistered model with the modeling controlling for MAAS scores

posterior = posterior_samples(mod_h2_int) %>%
  transmute(`mindful attention`= b_dot_between_std_noc + `b_trial_condregulation:dot_between_std_noc`,
            reactivity = b_dot_between_std_noc) %>%
  gather(`trial type`, value) %>%
  mutate(model = "original model") %>%
  bind_rows(posterior_samples(mod_ph_h2) %>%
              transmute(`mindful attention`= b_dot_between_std_noc + `b_trial_condregulation:dot_between_std_noc`,
                        reactivity = b_dot_between_std_noc) %>%
              gather(`trial type`, value) %>%
              mutate(model = "controlling for MAAS")) %>% 
  mutate(model = factor(model, levels = c("original model", "controlling for MAAS")))

posterior %>%
  ggplot(aes(y = "", x = value, fill = model)) +
  stat_halfeye(alpha = .5) +
  scale_fill_manual(values = palette_group) +
  facet_grid(~`trial type`) +
  scale_y_discrete(expand = c(.1, .1)) +
  labs(x = "\nregression coefficient\n", y = "") + 
  plot_aes